<?php
namespace Plugin\Attractions\Inspection\Schema\Inspection_exception;

use Plugin\Attractions\Inspection\Model\Inspection_exception\InspectionException;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 临时巡检
 */
#[Schema(title: 'InspectionExceptionSchema')]
class InspectionExceptionSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: 'ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'type', title: '事件类型（“故障”、“告警”）', type: 'tinyint')]
    public string $type;

    #[Property(property: 'date', title: '异常时间', type: 'datetime')]
    public string $date;

    #[Property(property: 'content', title: '事件内容/描述', type: 'varchar')]
    public string $content;

    #[Property(property: 'status', title: '处理状态 1已处理 2未处理 3已接收', type: 'tinyint')]
    public string $status;

    #[Property(property: 'inspector', title: '巡检人', type: 'array')]
    public array $inspector;

    #[Property(property: 'devices', title: '巡检设备', type: 'array')]
    public array $devices;

    #[Property(property: 'start_time', title: '巡检开始时间', type: 'datetime')]
    public string $start_time;

    #[Property(property: 'end_time', title: '巡检结束时间', type: 'datetime')]
    public string $end_time;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;




    public function __construct(InspectionException $model)
    {
       $this->id = $model->id;
       $this->type = $model->type;
       $this->date = $model->date;
       $this->content = $model->content;
       $this->status = $model->status;
       $this->inspector = $model->inspector;
       $this->devices = $model->devices;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'type' => $this->type ,'date' => $this->date ,'content' => $this->content ,'status' => $this->status ,'inspector' => $this->inspector ,'devices' => $this->devices ,'start_time' => $this->start_time ,'end_time' => $this->end_time ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at];
    }
}